import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'
import { NgModule } from '@angular/core';
import { Router, RouteReuseStrategy } from '@angular/router';

import { ElModule } from 'element-angular'
import { ChartModule } from 'angular2-highcharts';
import { HighchartsStatic } from 'angular2-highcharts/dist/HighchartsService';

import { AppRoutingModule } from './router/router.module';
import { AppComponent } from './component/manager/app/app.component';
import { ConsoleComponent } from './component/manager/console/console.component';

import { HomeComponent } from './component/manager/home/home.component';
import { AlgorithmListComponent } from './component/manager/algorithm-list/algorithm-list.component';
import { AlgorithmInfoComponent } from './component/manager/algorithm-info/algorithm-info.component';
import { AlgorithmEditComponent } from './component/manager/algorithm-edit/algorithm-edit.component';
import { RecordComponent } from './component/manager/record/record.component';

import { ChartComponent } from './component/ui/chart/chart.component';
import { ScopeComponent } from './component/ui/scope/scope.component';

import { SubScribeService } from './service/subscribe.service'
import { SimpleReuseStrategy } from './providers/reuse-strategy';

declare var require: any;
export function highchartsFactory() {
  return require('highcharts/highstock');
}

@NgModule({
  declarations: [
    AppComponent,
    ConsoleComponent,
    HomeComponent,
    AlgorithmListComponent,
    AlgorithmInfoComponent,
    AlgorithmEditComponent,
    RecordComponent,

    ChartComponent,
    ScopeComponent
  ],
  imports: [
    BrowserModule,
    BrowserAnimationsModule,
    AppRoutingModule,
    ChartModule,
    ElModule.forRoot()
  ],
  providers: [
    SubScribeService,
    {
      provide: HighchartsStatic,
      useFactory: highchartsFactory
    },

    {
      provide: RouteReuseStrategy,
      useClass: SimpleReuseStrategy
    },
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }
